<?php
/**
 * @package		Joomla.Site
 * @subpackage	mod_search
 * @copyright	Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

// no direct access
defined('_JEXEC') or die;
$id = JRequest::getVar('id',1);
?>
	<form id="contact-form" action="<?php echo JRoute::_('index.php'); ?>" method="post">
		<div class="input-block ip-col-2">
			<input name="name" id="name" type="text" class="f-input i-toggle" value="<?php echo JText::_('MOD_QUICKCONTACT_NAME'); ?>">
		</div>
		<div class="input-block ip-col-2 col-last">
			  <input name="company" id="company" type="text" class="f-input i-toggle" value="<?php echo JText::_('MOD_QUICKCONTACT_COMPANY'); ?>">
		</div>
		<div class="input-block ip-col-2">
			 <input name="email" id="email" type="text" class="f-input i-toggle" value="<?php echo JText::_('MOD_QUICKCONTACT_EMAIL'); ?>">
		</div>
		<div class="input-block ip-col-2 col-last">
			 <input name="phone" id="phone" type="text" class="f-input i-toggle" value="<?php echo JText::_('MOD_QUICKCONTACT_PHONE'); ?>">
		</div>
		<div class="clear"></div>
		<div class="input-block">
			  <textarea name="message" id="message" class="i-toggle"><?php echo JText::_('MOD_QUICKCONTACT_MESSAGE'); ?></textarea>
		</div>
		<div class="clr"></div>
		<div class="form-submit clearfix">
			 <a href="javascript:void(0)" onclick="jQuery('#contact-form').submit();" class="btnSend fll">Send</a>
			<p id="p-field2"><?php echo JText::_('COM_ACYMAILING_REQUIRED_FIELDS'); ?></p>
		</div>
		<input type="hidden" name="option" value="com_contact" />
		<input type="hidden" name="task" value="contact.submit" />
		<input type="hidden" name="id" value="<?php echo $id; ?>" />
		<?php echo JHtml::_( 'form.token' ); ?>
	</form>
              
 <?php                        	       
$input_fname = JText::_( 'Please Enter Your First Name' );
$input_lname = JText::_( 'Please Enter Your Last Name' );
$input_name = JText::_( 'Please Enter Your Name' );
$input_title = JText::_( 'Please Enter Your Title' );
$input_company = JText::_( 'Please Enter Your Company' );
$input_phone = JText::_( 'Please Enter Your Phone' );
$input_email = JText::_( 'Please Enter Your Email' );
$input_country = JText::_( 'Please Enter Your Country' );
$input_industry = JText::_( 'Please Enter Your Industry' );
$input_node = JText::_( 'Please Enter Your Estimated nodes' );
$input_message = JText::_( 'Please Enter Your Message' );
?>                       
 <script type="text/javascript">                   
jQuery(document).ready(function(jQuery) {
	jQuery.validator.addMethod('postalcode', function (value) { 
		if(value=='') return true;	
		return /^\d{4}$/.test(value); 
	   }, '');
	jQuery.validator.addMethod("notEqual", function(value, element, param) {
			return this.optional(element) || value !== param;
	});
		//jQuery("#postcode").mask("9999",{placeholder:""});  
		jQuery('#contact-form').validate(
			{
				errorPlacement: function(error, element) {			
			},
			invalidHandler: function(form, validator) {
			  var errors = validator.numberOfInvalids();
			if (errors) {
                //$('#alert').html(validator['errorList'][0]['message']);
				jQuery('#alert').html(validator['errorList'][0]['message']);
    			jQuery('#backoverlay').show();
    			jQuery('#show_popup').show();
            	jQuery('#f_focus').html(validator['errorList'][0]['element'].name);
				validator['errorList'][0]['element'].focus();
				
			  } else {
			  }
			},
			rules: {
				name:{
					required: true,
					notEqual: "<?php echo JText::_('MOD_QUICKCONTACT_NAME'); ?>",
				},		
				
				company:{
					required: true,
					notEqual: "<?php echo JText::_('MOD_QUICKCONTACT_COMPANY'); ?>",
				},	
				email:{
					required: true,
					email: true,
				},	
				phone:{
					required: true,
					digits:true,
					minlength:6,
				},
				
				message:{
					required: true,
					notEqual: "<?php echo JText::_('MOD_QUICKCONTACT_MESSAGE'); ?>",
				},
			},
			messages: {
				name: "<?php echo $input_name; ?>",
				company: "<?php echo $input_company; ?>",
				email: "<?php echo $input_email; ?>",
				phone: "<?php echo $input_phone; ?>",
				message: "<?php echo $input_message; ?>",
				
			
			}
		});
        close_popup=function(){		
			var fel=jQuery('#f_focus').html();
            jQuery('#backoverlay').hide();
    		jQuery('#show_popup').hide();
    		jQuery('#' + fel ).focus();		
      };
      
      
	});
</script>


